Skip to content

fix(service-analytics): a lookup dataset dimension serves the referenced record's name for a relationship path and for a target titled by its nameField - #33136

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-tmxcnj
Nov 13, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-tmxcnj

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #33107

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:数据集的查找(lookup)维度现在在两种情况下显示被引用记录的名称,而不是 id:一是关系路径维度(如 account.owner_id,显示负责人的名字);二是目标对象以 nameField 作标题(如自动编号的订单号 SO-2026-0002)。排序也按显示的名称排。
  • 为什么改:下游应用在 18.3.0 上的仪表盘这两种维度都显示原始 id,它的卡因此被挡住(analytics: the dimension-label pass returns raw ids for a relationship-path lookup dimension, and ignores the target object's nameField #33107,p1)。路径维度以前只在基础对象的字段表里找字段;标签读取以前从不看目标对象声明的 nameField。
  • 风险与回滚:patch 级,只改 service-analytics 的标签读取,不改查询、分组和规格(Clause-② no,元数据协议不变)。分组仍按 id,两个同名的人仍是两行;API 不暴露的目标、行级权限隐藏的记录仍显示 id。注册表会给每个自有对象指定 nameField,所以标题字段与旧规则不同的目标,现在显示的是平台其他地方显示的那个标题。回滚就是还原本 PR。
  • 先看:packages/services/service-analytics/src/dimension-labels.ts(dimensionColumn 与 pickDisplayField)、analytics-service.ts 里 columnObjectOfField(复用查询本身用的 columnObjectOf)、plugin.ts 的 fetchRecordLabels。
  • 两分钟验证:pnpm --filter @objectstack/rest exec vitest run src/analytics-dataset-lookup-dimension-labels.test.ts,预期 6 个全部通过(REST、query_dataset 工具、直接调用三个入口给出同样带名称的行)。
  • 需要你做的:无,席位落地。

What changes

A, relationship-path lookups. resolveDimensionLabels and the sort-key resolver (createOrderLabelResolver) looked a dimension's field up on the base object's field map only. A path such as account.owner_id found no field meta there, so its FK id was served. Each dimension the service hands to the label passes now carries columnObject, the object the path's column lives on, and both passes read the column's meta (owner_id) on that object.

  • columnObject comes from columnObjectOf (hop-object.ts), over the compiled dataset cube's joins and the service's hopReference. That is the one hop resolver the query's joins, the field gate and the read scope already use, so the object labelled is the object the query read. The label module walks no path of its own.
  • A select column at the end of a path now serves its option label, translated under that object and column (translateSelectOptions(columnObject, column, …)).
  • A dimension without columnObject reads field verbatim on the base object, as before.

B, targets titled by nameField. pickDisplayField(fields, nameField?) returns the target's declared nameField first, when the field map declares it and it is not virtual (the spec's isVirtualSearchField, i.e. not a formula). Otherwise it falls back to the old order: name, title, label, then the first text field. plugin.ts fetchRecordLabels passes the target schema's nameField. Before this, a target titled by an autonumber with no name/title/label field was read through its first text field, the platform-injected ownership queue, which is null on every row. No label came back and the id was served.

Callers of pickDisplayField. There is one production caller, plugin.ts fetchRecordLabels, and it now passes nameField. The other references are the package export (index.ts, where the added parameter is optional) and the tests in dimension-labels.test.ts and dataset-reference-dimension-labels.test.ts, which call it without nameField and keep their answers. Nothing outside service-analytics imports it (repo-wide grep over packages/ and ui/).

MCP query_dataset. It does not have a label path of its own. The MCP tool (mcp-http-tools.ts) calls the runtime bridge (packages/runtime/src/domains/mcp.ts, service.datasetTools(…).queryDataset), which calls AnalyticsService.queryDataset, which runs this label pass. The new integration test pins that the query_dataset executor serves the same labelled rows as the REST door. packages/mcp is not touched.

Tests

  • packages/rest/src/analytics-dataset-lookup-dimension-labels.test.ts (new) runs on a real ObjectQL engine over SQLite, with the analytics service AnalyticsServicePlugin registers and its real fetchRecordLabels bridge. Every case asserts that three faces return equal rows: POST /analytics/dataset/query with datasetName, the query_dataset tool executor, and the direct queryDataset call. The cases:
    • A: account.owner_id is labelled with the rep's name. Two reps who share the name "Sam Lee" stay two rows, because grouping is by id.
    • A: order asc on that dimension sorts by name, and limit: 1 takes its window over that order. The ids sort the opposite way.
    • A: the card's second path, cb_order.carbon_grade, is labelled with the grade name.
    • A, gated: account.region, whose label target declares enable.apiEnabled: false, still renders the stored id.
    • B: a lookup to an autonumber nameField target, with the injected queue field ahead of it, is labelled with the order number.
    • CONTROL: a lookup to an object whose title is its name field labels as before.
  • dimension-labels.test.ts, in its existing pickDisplayField describe: nameField comes before the convention, the CONTROL cases (nameField: 'name', absent, empty) pick as before, and a nameField missing from the map or naming a formula falls through. A new top-level describe covers relationship-path dimensions: a user column on the hop object, a select column translated under the hop object, an unresolved path that stays raw, and the sort-key pass on the same column.

Acceptance notes

  • The nameField reach is wider than the card's shape. SchemaRegistry designates nameField on every owned object that has a title-eligible field (ADR-0079, provisionPrimary with synthesize: false). So the label read now follows each target's designated title, not only an explicit autonumber one. Where the old rule and the designated title already agree (an object with a text name field), nothing changes. Where they differ, for example an object whose title is subject or full_name, the dashboard now shows the title the rest of the platform shows for that record.
  • Formula titles are still skipped. A text-formula nameField has no column the label read (an aggregate grouped by id and the display field) can group by, so the label is read from the old convention, as before. Serving a formula title on this read would be its own change.
  • displayNameField (the deprecated alias) is not read here. Schema parse copies it onto nameField, and the registry reads the parsed schema.
  • A relationship field named order breaks the query. While building the fixture, a dataset with include: ['order'] and a dimension on that field answered 500 DATABASE_ERROR on the REST door (SQLite: near "order": syntax error), at origin/main and with this change alike. The fixture uses cb_order, as the card does. This is reported to the seat to file. Dedupe words: dataset include reserved word, relationship alias unquoted, near order syntax error.
  • The integration test lives in packages/rest. That package hosts the POST /analytics/dataset/query route, and its tests already build the real engine and plugin rig this test copies (analytics-dataset-ai-tools-parity.test.ts).

Verification

On head 99fa452b unless stated. Head 99fa452b differs from 026cdd93 only in a type annotation in dimension-labels.test.ts.

Measurement at origin/main 7c36f52 (the new integration test, before the fix)

4 failed, 2 passed. Each face returned the same rows, and the rows carried ids:

  • rep: rep_a, rep_b, rep_c (expected the names);
  • the sort: rep_a, rep_b, rep_c (expected Sam Lee, Sam Lee, Zed Young);
  • grade: gr_330, gr_550 (expected N330, N550);
  • order: ord_1, ord_2 (expected SO-2026-0001, SO-2026-0002).

The two that passed are the gated region case and the CONTROL.

Ablations (scripts/ablation-replace.mjs; service-analytics rebuilt each leg, marker proved in dist/ with ablation-dist-preflight.mjs, restored with the blob equal to HEAD, git diff HEAD empty and the marker proved absent)
  • A, dimensionColumn forced to ignore columnObject: the rest test has 3 red (rep label, sort, grade) and 3 green (region, B, CONTROL). The unit files have 3 red (the path describe's user, select and sort-key cases).
  • B, the nameField branch disabled: 1 red in rest (the order number) and 1 red in the unit tests (nameField before the convention).
  • Exposure gate, withServedLabelTargets made to serve every target: 1 red in rest (the region path renders East) and 9 red in dimension-label-exposure.test.ts.
  • Grouping by id, with the forbidden behaviour put back (the display pass merges rows that render the same label): 2 red in rest (rep label and sort, one "Sam Lee" row lost) and 1 red in the unit tests.
Suites, typecheck, lint, gates
  • pnpm --filter @objectstack/service-analytics test: 215 files, 5192 passed and 332 skipped (026cdd93). pnpm --filter @objectstack/rest test: 409 files, 8330 passed and 332 skipped (026cdd93).
  • typecheck, which includes the test files: service-analytics exit 0 on 99fa452b; rest exit 0 on 026cdd93.
  • pnpm lint: exit 0 (026cdd93).
  • Full declaration build (turbo run build --filter='!@objectstack/docs', no OS_SKIP_DTS): exit 0.
  • dispatch-gates.mjs --commands derived 72 gates. On 026cdd93, 71 exited 0. check-plugin-teardown-shape.mjs --self-test exited 3 there because the shallow clone lacked its pinned fixture commit; after fetching 621a4876 it exited 0. All 72 were rerun on 99fa452b, every one exit 0, and dispatch-gates.mjs --ran (with an exit code on every line) reports: 72 derived, 72 run, 0 NOT-MEASURED, 0 UNRUN. ESLint on the file changed after the pnpm lint run: exit 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibzrvnam3RUBqcsfRHq

…ect and the target's nameField

A relationship-path dimension (hop.column) now reads its column's field meta on
the object the path's last hop reaches, named by the one hop resolver the query
joins with, in the display pass and the sort-key pass. The label read prefers
the target object's declared nameField before the name/title/label/first-text
convention.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzrvnam3RUBqcsfRHq
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-analytics, touching 10 documentable anchor(s).

17 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 5b2ec820c8abca113eae23745f71331f55ec7aed.

⛔ 3 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 5b2ec820c8abca113eae23745f71331f55ec7aed → packageMentionDocs.

Which tree this was computed on

This run read content/docs from b839115baa8703efe1313eac892a42eb2b705bc5 — the merge of head 99fa452be030d5ac9775b4a16db085053ac16f60 into base 5b2ec820c8abca113eae23745f71331f55ec7aed, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin b839115baa8703efe1313eac892a42eb2b705bc5 && git checkout b839115baa8703efe1313eac892a42eb2b705bc5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 5b2ec820c8abca113eae23745f71331f55ec7aed 99fa452be030d5ac9775b4a16db085053ac16f60 && git checkout -B drift-repro 5b2ec820c8abca113eae23745f71331f55ec7aed && git merge --no-ff 99fa452be030d5ac9775b4a16db085053ac16f60

node scripts/docs-audit/affected-docs.mjs --json 5b2ec820c8abca113eae23745f71331f55ec7aed

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 5b2ec820c8abca113eae23745f71331f55ec7aed → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

维护者速读 · PR #33136 @ 99fa452b · 2026-11-13T17:21Z

  • 改了什么:数据集的查找维度在两种情况下显示被引用记录的名称而不是 id:关系路径维度(如 account.owner_id 显示负责人名字),以及目标对象用 nameField 作标题(如订单号 SO-2026-0002)。排序也按显示的名称排。
  • 为什么改:下游应用在 18.3.0 上的仪表盘这两种维度都显示原始 id,卡 analytics: the dimension-label pass returns raw ids for a relationship-path lookup dimension, and ignores the target object's nameField #33107(p1)因此被挡住。
  • 权限与边界:只改 service-analytics 的标签读取,不改查询、分组和规格。分组仍按 id,同名的两个人仍是两行;API 不暴露的目标、行级权限隐藏的记录仍显示 id。
  • 风险与回滚:patch 级。注册表给每个自有对象都指定了 nameField,所以标题字段和旧规则不同的目标,现在显示的是平台其他地方用的那个标题。回滚就是 revert。
  • 先看:dimension-labels.ts 的 dimensionColumn 与 pickDisplayField;analytics-service.ts 的 columnObjectOfField(复用查询本身的 columnObjectOf);plugin.ts 的 fetchRecordLabels。
  • 需要你做的:无,席位落地。
  • 席位意见:落地。没有契约面(Clause-② no,元数据协议不变),席位自读通过:路径解析复用查询用的同一个 hop 解析器,nameField 优先、公式标题照旧跳过;CI 全绿;没有碰受管面,改动 551 行。

席位核对

  • 形态: draft → main,正文 Fixes #33107,合并后应当关卡;正文其余地方没有挨着别的 open 卡号的闭合关键词。Clause-②: no、Metadata-protocol: none;changeset 33107-dimension-labels-path-and-namefield.md 是 @objectstack/service-analytics patch,与只改标签读取一致。没有改 content/docs/releases/。文件面 = 认领 6857418931:service-analytics 三个源文件、两个测试、一个 changeset。
  • 前提实测: dev 在 origin/main 7c36f524 上测过新集成测试:4 红 2 绿,三个入口的行都带 id(报告 6859182798)。
  • 门禁 check-runs @ 99fa452b: 51 个,35 success、16 skipped、0 失败。本地:service-analytics 215 个文件,5192 通过;rest 409 个文件,8330 通过;typecheck 与 pnpm lint exit 0;完整声明构建 exit 0。四组消融(A 路径、B nameField、暴露闸门、按 id 分组)都转红并已恢复。
  • 契约复审: 不适用。Clause-② no 且无 narrowing、schema 或受管路径,所以没有契约面。席位自读了 diff:columnObject 取自 hop-object.ts 的 columnObjectOf,与查询的 join、字段闸门、读取范围同源;pickDisplayField 唯一的生产调用方 fetchRecordLabels 传了 nameField,其余调用方不传,答案不变。
  • 接受的偏差: 无。
  • 范围外去向: 名为 order 的关系字段让查询 500(SQLite 保留字,origin/main 上同样)→ 已立卡 analytics: a dataset whose include names a relationship field called order answers 500 DATABASE_ERROR (unquoted SQL alias) #33138。
  • 落地条款: 维护者常设落地令 「按 pm-dispatch 审过的pr你可以自主落地」 (2026-10-30T14:20Z)。非受管面(check-governed-merges --pr 33136:0/6 命中);551 行 ≤ 3000。K = 1(PRBASE 5b2ec820,取自 Test Core 计划的 Affected-set diff base;origin/main a83c3667),< 15,无需先 merge main。与 PR feat(storage,mcp): an upload link for a file field of a record not yet created #33123、fix(service-analytics)!: query_dataset refuses a selection that names no measure, as the REST dataset door does #33141 没有文件重叠。没有新的语种包。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 13, 2026 17:22
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 69c77ad Nov 13, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-tmxcnj branch November 13, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

analytics: the dimension-label pass returns raw ids for a relationship-path lookup dimension, and ignores the target object's nameField

2 participants